package com.rainng.coursesystem.controller.member;

import com.rainng.coursesystem.config.themis.annotation.Member;
import com.rainng.coursesystem.controller.BaseController;
import com.rainng.coursesystem.model.vo.response.ResultVO;
import com.rainng.coursesystem.service.member.EventSelectService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Member
@RequestMapping("/member/event/select")
@RestController
public class EventSelectController extends BaseController {
    private final EventSelectService service;

    public EventSelectController(EventSelectService service) {
        this.service = service;
    }

    @RequestMapping("/page/count")
    public ResultVO getPageCount(String eventName, String leaderName) {
        return service.getPageCount(eventName, leaderName);
    }

    @RequestMapping("/page/{index}")
    public ResultVO getPage(@PathVariable Integer index, String eventName, String leaderName) {
        return service.getPage(index, eventName, leaderName);
    }

    @PostMapping("/{id}")
    public ResultVO create(@PathVariable Integer id) {
        return service.create(id);
    }
}
